package utils;

import java.sql.Connection;
import java.sql.DriverManager;

public class GetConnection {

    private static String address="jdbc:mysql://localhost:13306/feifei?useSSL=false&serverTimezone=UTC";
    private static String dataBaseName="root";
    private static String dataBasePwd="abc123";

    public static Connection getConn() {
        Connection conn=null;
        try {
            //加载jdbc驱动
            Class.forName("com.mysql.cj.jdbc.Driver");
            //连接数据库
            conn= DriverManager.getConnection(address,dataBaseName,dataBasePwd);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("连接失败！");
        }
        return conn;
    }
}